namespace org.lionsoul.ip2region
{

    /// <summary>
    /// database configuration class
    /// 
    /// @author chenxin<chenxin619315@gmail.com>
    /// </summary>
    public class DbConfig
    {
        /// <summary>
        /// total header data block size
        /// </summary>
        private int totalHeaderSize;

        /// <summary>
        /// max index data block size
        /// u should always choice the fastest read block size 
        /// </summary>
        private int indexBlockSize;

        /// <summary>
        /// construct method
        /// </summary>
        /// <param name="totalHeaderSize"> </param>
        /// <param name="dataBlockSize"> </param>
        /// <exception cref="DbMakerConfigException">  </exception>
        //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        //ORIGINAL LINE: public DbConfig(int totalHeaderSize) throws DbMakerConfigException
        public DbConfig(int totalHeaderSize)
        {
            if ((totalHeaderSize % 8) != 0)
            {
                throw new DbMakerConfigException("totalHeaderSize must be times of 8");
            }

            this.totalHeaderSize = totalHeaderSize;
            this.indexBlockSize = 4096; //4 * 1024
        }

        //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
        //ORIGINAL LINE: public DbConfig() throws DbMakerConfigException
        public DbConfig()
            : this(8192)
        {
        }

        public virtual int TotalHeaderSize
        {
            get
            {
                return totalHeaderSize;
            }
        }

        public virtual DbConfig setTotalHeaderSize(int totalHeaderSize)
        {
            this.totalHeaderSize = totalHeaderSize;
            return this;
        }

        public virtual int IndexBlockSize
        {
            get
            {
                return indexBlockSize;
            }
        }

        public virtual DbConfig setIndexBlockSize(int dataBlockSize)
        {
            this.indexBlockSize = dataBlockSize;
            return this;
        }
    }
}